import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
df=pd.read_csv("jichi.csv",header=None,encoding="utf-8")
price=df[1]
max=df[1].min()
min=df[1].max()
print(max,min)
#十到五十区间的个数
tf=df[(df[1]>=10)&(df[1]<=50)][1].count()
print(tf)
#五十到一百区间的个数
fh=df[(df[1]>50)&(df[1]<=100)][1].count()
print(fh)
#一百到一百五十区间的个数
hf=fh=df[(df[1]>100)&(df[1]<=150)][1].count()
print(hf)
#一百五十到二百区间的个数
fth=df[(df[1]>150)&(df[1]<=200)][1].count()
print(fth)
#两百到二百五区间的个数
thf=df[(df[1]>200)&(df[1]<=250)][1].count()
print(thf)
#二百五到三百区间的个数
thft=df[(df[1]>250)&(df[1]<=300)][1].count()
print(thft)
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
s=pd.Series([tf,fh,hf,fth,thf,thft],index=["10~50","50~100","100~150","150~200","200~250","250~300"],name="价格分布（元）")
#柱状图
s.plot(kind="bar",alpha=1)
#饼图
plt.axhline(0,color='k')
s.plot.pie(figsize=(6,6))
s.plot.pie(labels=["10~50","50~100","100~150","150~200","200~250","250~300"],
        autopct='%.2f',fontsize=15,figsize=(6,6),subplots=True)
#密度图
s=pd.Series([tf,fh,hf,fth,thf,thft])
s.plot.density()
plt.show()
#折线图
plt.ion()
fig=plt.figure(figsize=(10,10))
s=pd.Series(df[1])
s.plot(color='r',linestyle='-')